/**
 * 
 */
package com.mes.schedule.manager.iface;

import java.util.Date;
import java.util.List;

import com.mes.basicdata.domain.CalendarData;
import com.mes.schedule.domain.SCalendar;
import com.mes.schedule.domain.ScheduleScheme;

/**
 * @author Administrator
 * 
 */
public interface IScheduleCalendarManager {

	public SCalendar initCalendar(ScheduleScheme scheme, String calendarUid)
			throws Exception;

	/**
	 * 放在调度里，想让基准日历的修改也可以立即生效 添加日历例外
	 */
	public SCalendar saveException(ScheduleScheme scheme,
			List<CalendarData> exceptionCalendarDataList) throws Exception;

	/**
	 * 添加日历
	 * 
	 * @param scheme
	 * @param weekDayCalendarDataList
	 * @return
	 * @throws Exception
	 */
	public SCalendar saveCalendarWeekDay(ScheduleScheme scheme,
			List<CalendarData> weekDayCalendarDataList) throws Exception;

	/**
	 * 添加数据
	 * 
	 * @param scheme
	 * @param CalendarDataList
	 * @return
	 * @throws Exception
	 */
	public SCalendar saveCalendarData(ScheduleScheme scheme,
			List<CalendarData> CalendarDataList) throws Exception;

	// 添加数据
	public SCalendar saveCalendarData(ScheduleScheme scheme,
			String calendarUid, List<CalendarData> CalendarDataList)
			throws Exception;

	/**
	 * 获取基准日历列表信息
	 */
	public List<SCalendar> getBaseCalendarList(String scheduleUid)
			throws Exception;

	public SCalendar getCalendar(ScheduleScheme scheme, String calendarUid)
			throws Exception;

	public void updateCalendar(SCalendar calendar) throws Exception;

	/**
	 * 重新初始化调度方案中所有日历
	 * 
	 * @param scheme
	 * @throws Exception
	 */
	public void reInitSchemeCalendar(ScheduleScheme scheme) throws Exception;

	/**
	 * 取得段日历在某个时间点的状态
	 * 
	 * @param resource
	 * @param segement
	 * @return
	 */
	public int getSegementCalendar(SCalendar calendar, int segement);

	/**
	 * 初始化系统内置日历
	 * 
	 * @param scheme
	 */
	public void initSystemDefaultCalendar(ScheduleScheme scheme);

	/**
	 * /** 给定时间长度，根据日历定义自动推算结束时间hba
	 * 
	 * @param scalendar
	 * @param startCalDate
	 *            开始计算时间
	 * @param estiTime
	 *            计算时间长度
	 * @return
	 * @throws Exception 
	 */
	public Date calFinishDate(SCalendar scalendar, Date startCalDate,
			double estiTime) throws Exception;
}
